<?php

namespace Modules\Admin\Entities;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;

class Modules extends Model
{
    protected $fillable = ['title','name','is_default','home_access'];

//    我要干啥
//    点击设为默认，点击的这个模块的is_default=1,其他变为0

    public function setDefault(){
        \DB::table('modules')->update(['is_default'=>0]);
        $this->is_default=1;
        $this->save();


    }


}
